(define (deep-reverse l)
  (if (pair? l)
    (append (deep-reverse (cdr l)) (list (deep-reverse (car l))))
    l))
